﻿using System;
using System.Data;
using System.Windows.Forms;
using System.Data.SqlClient;
using QuanLyTuyenSinh.Base;

namespace QuanLyTuyenSinh.Reports
{
    public partial class ReportDSPhongThi : Form
    {
     public ReportDSPhongThi()
        {
            InitializeComponent();
        }

      
        private void ReportDSPhongThiAllKhoi_Load(object sender, EventArgs e)
        {
            cbKhoiPhong.DataSource = monthibus.GetKhoithiUngVoiNganhHoc();
            cbKhoiPhong.ValueMember = "Khoithi";
            cbKhoiPhong.DisplayMember = "Khoithi";
        }

        private void cbKhoiPhong_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                cbPhong.DataSource = monthibus.LoadPhongthitheokhoithi(Convert.ToString(cbKhoiPhong.Text));
                cbPhong.ValueMember = "Phongthi";
                cbPhong.DisplayMember = "Phongthi";
            }
            catch (Exception ex)
            {
                return;
            }
        }
        private void cmdDS_Click(object sender, EventArgs e)
        {  
            SqlCommand cmd = new SqlCommand("select SBD,Phongthi,Hodem,Ten,Khoithi,Gioitinh from TSSBD where Phongthi='"+cbPhong.Text.Trim()+"' and Khoithi='"+cbKhoiPhong.Text.Trim()+"'", ConnectData.Getcon());
            SqlDataAdapter DTA = new SqlDataAdapter(cmd);
            DataTable DTL = new DataTable();
            DataSet DTS = new DataSet();
            DTA.Fill(DTS, "TSSBD");
            DTL = DTS.Tables["TSSBD"];
            rptDSPT cry = new rptDSPT();
            cry.SetDataSource(DTL);
            CryStalDSPhong.ReportSource = cry;
            CryStalDSPhong.Refresh();
        }
    }
}
